﻿<%@ page pageEncoding="UTF-8"%>
<%@include file="/util/tag.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <%@include file="../common/head.jsp"%>
    
        <script language="javascript" type="text/javascript">
            function deleteRole(id) {
                var r = window.confirm("确定要删除此角色吗？");
                if(!r)	return;
                var b = request('delete?id='+id,'删除成功！','删除错误！该角色被使用，不能删除。',$("#operate_msg"));
                if(!b){
                	$("#operate_result_info").attr("class","operate_fail");
                	}
                document.getElementById("operate_result_info").style.display = "block";
            }
        </script>
        
    <body>
        <%@include file="../common/top.jsp"%>
        
        <div id="main">
            <form action="" method="post">
                <!--查询-->
                <div class="search_add">
                    <input type="button" value="增加" class="btn_add" onclick="location.href='toAdd?page=${page}'" />
                </div>  
                <!--删除的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';location.reload();" />
                   <span id="operate_msg">删除成功！</span>
                </div> <!--删除错误！该角色被使用，不能删除。-->
                <!--数据区域：用表格展示数据-->     
                <div id="data">                      
                    <table id="datalist">
                        <tr>                            
                            <th>角色 ID</th>
                            <th>角色名称</th>
                            <th class="width600">拥有的权限</th>
                            <th class="td_modi"></th>
                        </tr>
                        <s:iterator value="roleList">                
                        <tr>
                            <td>${id}</td>
                            <td>${name}</td>
                            <td><s:property value="toModules()"/></td>
                            <td>
                                <input type="button" value="修改" class="btn_modify" onclick="location.href='toUpdate?page=${page}&id='+${id};"/>
                                <input type="button" value="删除" class="btn_delete" onclick="deleteRole(${id});" />
                            </td>
                        </tr>
                        </s:iterator>      
                        
                    </table>
                </div> 
                <!--分页-->
                <div id="pages">
        	        <s:if test="page>1">
        	        <a href="?page=${page-1}">上一页</a>
        	        </s:if><s:else><a>上一页</a></s:else>
        	        <s:iterator begin="1" end="pageCount" var="i">
                    <a href="?page=${i}" <s:if test="page==#i">class="current_page"</s:if> >${i}</a>
                 </s:iterator>
                 <s:if test="page<pageCount">
        	        <a href="?page=${page+1}">下一页</a>
        	        </s:if><s:else><a>下一页</a></s:else>
                </div>
            </form>
        </div>

         <%@include file="../common/bottom.jsp"%>
    </body>
</html>
